const Sequelize = require('sequelize')
const sequelize = require('../config/index')
const TaskList = require('./taskList').TaskList

let TaskReply = sequelize.define('taskReply',{
    uid:{
        type:Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment:'uid',
    },
    name:{
        type:Sequelize.STRING,
        defaultValue:'',
        comment:'任务名称',
    },
    belong:{
        type:Sequelize.STRING,
        defaultValue:'admin',
        comment:'任务归属',
    },

    describe:{
        type:Sequelize.STRING,
        defaultValue:'无',
        comment:'任务描述',
    },
    time:{
        type:Sequelize.STRING,
        defaultValue:'无',
        comment:'任务周期',
    },
    status:{
        type:Sequelize.INTEGER,
        defaultValue:0,
        comment:'任务状态 0 1 2 3',
    },
    describe:{
        type:Sequelize.STRING,
        defaultValue:0,
        comment:'任务描述',
    },
    isDel:{
        type:Sequelize.STRING,
        defaultValue:0,
        comment:'是否已删除'
    },
},{
    // freezeTabelName 为 true 时不会在库中映射表时增加复数表名
    // 该选项为 true 时，user 在映射时映射成 user，而为 false 时会映射成users
    freezeTableName: true,
})
TaskReply.belongsTo(TaskList,{foreignKey: "taskid"});
// Skill.belongsToMany(User, {through : 'userSkill'});
//这会创建一个新模型UserProject,其中projectId和userId两个外键。定义through选项后，Sequelize会尝试自动生成名字。
//在本例中，会为User添加方法getUsers,setUsers,addUser,addUsers到Project中。getProjects,setProjects,addProject,addProjects到User中.


let taskReply = TaskReply.sync();

exports.TaskReply = TaskReply
